package com.derbysoft.lowcostadapter.dswitch3.service.impl;

import com.derbysoft.dswitch.remote.hotel.dto.*;
import com.derbysoft.dswitch.remote.hotel.provider.HotelProviderRemoteService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Created by: jason
 * Date: 2012-5-8
 */
public abstract class BaseHotelRemoteService implements HotelProviderRemoteService {

    private final Log logger = LogFactory.getLog(BaseHotelRemoteService.class);

    @Override
    public HotelDailyRateChangeResponse getDailyRateChange(HotelDailyRateChangeRequest request) {
        return throwException(request);
    }

    @Override
    public HotelLOSRateChangeResponse getLOSRateChange(HotelLOSRateChangeRequest request) {
        return throwException(request);
    }

    @Override
    public HotelAvailStatusChangeResponse getAvailStatusChange(HotelAvailStatusChangeRequest request) {
        return throwException(request);
    }

    @Override
    public HotelAvailResponse getNoCachedAvailability(HotelAvailRequest request) {
        return throwException(request);
    }

    @Override
    public HotelCancelResponse cancelReservation(HotelCancelRequest request) {
        return throwException(request);
    }

    @Override
    public HotelInventoryChangeResponse getInventoryChange(HotelInventoryChangeRequest request) {
        return throwException(request);
    }

    @Override
    public HotelReservationResponse makeReservation(HotelReservationRequest request) {
        return throwException(request);
    }

    @Override
    public HotelPingResponse ping(HotelPingRequest request) {
        return throwException(request);
    }

    @Override
    public HotelChangeResponse getHotelChange(HotelChangeRequest request) {
        return throwException(request);
    }

    protected <RQ, RS> RS throwException(RQ request) {
        String message = String.format("Unsupported operation [%s]",
                request.getClass().getName());
        logger.warn(message);
        throw new UnsupportedOperationException(message);
    }
}
